/* 
 * File:   cfilerecord.cpp
 * Author: Peter Gerhat
 * 
 * Created on November 29, 2009, 6:16 PM
 */

#include "cfilerecord.h"
#include <iostream>
#include <cstring>
#include <string>


using namespace std;

CFileRecord::CFileRecord(string name, string section)
{
    this->name = name;
    this->section = section;
}

CFileRecord::~CFileRecord()
{

}

bool CFileRecord::operator == (const CFileRecord &record) const
{
    int b = strcmp (name.c_str(), record.name.c_str());
    int a = strcmp (section.c_str(), record.section.c_str());
    return (a == 0) && (b == 0);
}

bool CFileRecord::operator <  (const CFileRecord &record) const
{
    int b = strcmp (name.c_str(), record.name.c_str());
    int a = strcmp (section.c_str(), record.section.c_str());
    if (a <  0) return true;
    if ((a == 0) && (b < 0)) return true;
    return false;
}

bool CFileRecord::operator >  (const CFileRecord &record) const
{
    int b = strcmp (name.c_str(), record.name.c_str());
    int a = strcmp (section.c_str(), record.section.c_str());
    if (a >  0) return true;
    if ((a == 0) && (b > 0)) return true;
    return false;
}
